<div class="block">
	<div class="block-title">
		生成月报表
	</div>
	<div class="block-body" style="width:auto;">
		<ul>
			<li>
				生成 <strong><?php echo $month ?></strong> 的报表：<br /><br />
				
				<?php
				list($year, $month) = explode('-', $month);
				
				$userNum = User::getNumByAccept('P');
				$orderNum = FirstOrder::getNumToVerify();
				$msg = "";
				if ($userNum) {
					$msg = "有 $userNum 个注册会员未审核. ";
				} 
				if ($orderNum) {
					$msg .= "有 $orderNum 个[首次订单]未审核. ";
				}
				$disabled = "";
				if (!empty($msg)) {
					$disabled = "disabled='disable'";
					$msg .= "请先审核, 然后才能生成报表";
				}
				echo "<div style='color:red;margin-bottom:20px;'>$msg</div>";
				?>
				<form action="<?php echo $this->createUrl("payment/generateMonthReport", array('year' => $year, 'month' => $month))?>">
					<input type="submit" <?php echo $disabled?> value="生成报表" />
				</form>
				<br /><br /><br />
			</li>
			<li>
				<form action="<?php echo $this->createUrl('payment/generateMonthReport')?>">
					指定月份生成报表：<br /><br />
					<?php
					$y = date('Y');
					$mon = array();
					for($i=12; $i>0; $i--) {
						$j = $i;
						if ($j < 10) $j = '0'.$j;
						$mon[$j] = $j;
					}
					echo CHtml::dropDownList('year', $y, array($y => $y, $y-1 => $y-1)) . '年 ';
					echo Chtml::dropDownList('month', date('m', strtotime("-2 months")), $mon) . '月 '; 
					?>
					<input type="submit" <?php echo $disabled?> value="生成报表" />
				</form>
			</li>
		</ul>
	</div>
</div>